package errors

// ErrorStatus represents the status of an error response
type ErrorStatus string

const (
	StatusSucceed ErrorStatus = "succeed"
	StatusFailed  ErrorStatus = "failed"
	StatusSuspend ErrorStatus = "suspend"
	StatusPending ErrorStatus = "pending"
)

// ErrorConfig represents the configuration for platform-specific error responses
type ErrorConfig struct {
	Code    string      `json:"code"`    // Error code
	Message string      `json:"message"` // Error message
	Status  ErrorStatus `json:"status"`  // Error status
}

// PlatformErrorConfig represents error configurations for different payment platforms
type PlatformErrorConfig struct {
	PhotonPay map[string]ErrorConfig `json:"photonpay"` // PhotonPay platform error configurations
	// Add other platforms here in the future
}

// GetPlatformErrorConfig returns the error configuration for a specific platform
func GetPlatformErrorConfig(platform string) map[string]ErrorConfig {
	switch platform {
	case "photonpay":
		return PhotonPayErrorConfig
	default:
		return nil
	}
}

// GetErrorConfig returns the error configuration for a specific platform and error code
func GetErrorConfig(platform, code string) *ErrorConfig {
	config := GetPlatformErrorConfig(platform)
	if config == nil {
		return nil
	}

	if errorConfig, exists := config[code]; exists {
		return &errorConfig
	}
	return nil
}
